# 多线程实现
from do_something import *
import time
import threading

if __name__ == '__main__':
    start_time = time.time()
    size = 10000000
    threads = 10  # 线程数，也是要执行的次数
    jobs = []
    for i in range(0, threads):  # 创建10个线程，多个线程放在一个list里面
        out_list = list()
        thread = threading.Thread(target=do_somethong(size, out_list))
        jobs.append(thread)
    # 线程没有优先之分，一个接一个的实现的
    for j in jobs:  # 执行jobs里面的所有线程
        j.start()
    for j in jobs:  # 关闭所有线程
        j.join()
    end_time = time.time()
    print('List processing completed!')
    print('multithreading time=', end_time - start_time)
